Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate importer spilling code V2 #72744

Merged
merged 2 commits into from
Jul 26, 2022

Conversation

SingleAccretion
Copy link
Contributor

Same as #72291, but handles calls with return buffers correctly (second commit).

Fixes #72133.

* Add tests

* Fix losing GLOB_REF on the LHS

The comment states we don't need it, which is incorrect.

Diffs are improvements because we block forward substitution of
calls into "ASG(BLK(ADDR(LCL_VAR<field>, ...)))", which allows
morph to leave the "can be replaced with its field" local alone.

* Prospective fix

Spill "glob refs" on stores to "aliased" locals.

* Delete now-not-necessary code

* Fix up asserts

* Clean out '(unsigned)CHECK_SPILL_ALL/NONE' casts

* Don't manually spill for 'st[s]fld'

* Revert 'Clean out '(unsigned)CHECK_SPILL_ALL/NONE' casts'
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 24, 2022
@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Jul 24, 2022
@ghost
Copy link

ghost commented Jul 24, 2022

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

Same as #72291, but handles calls with return buffers correctly (second commit).

Fixes #72133.

Author: SingleAccretion
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

The mistake in logic was that the only trees which could modify
unaliased locals are assignments, which is not true, calls can
do that as well.

One day we will move the return buffer handling out of importer,
but until then, special handling is required.

An alternative fix would have been to bring back the explicit
"impSpillLclRefs" to "stloc/starg" code, but that would contradict
the overall goal of consolidating the spilling logic.
@SingleAccretion SingleAccretion marked this pull request as ready for review July 25, 2022 10:56
@SingleAccretion
Copy link
Contributor Author

@dotnet/jit-contrib

@AndyAyersMS
Copy link
Member

/azp run runtime-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@AndyAyersMS
Copy link
Member

AndyAyersMS commented Jul 26, 2022

R2R failures are #72822

@AndyAyersMS AndyAyersMS merged commit cea17b2 into dotnet:main Jul 26, 2022
@SingleAccretion SingleAccretion deleted the Spilling-Fixes-Fixed branch July 26, 2022 20:28
@jakobbotsch
Copy link
Member

jakobbotsch commented Aug 1, 2022

Unfortunately we have several silent bad codegen examples in the latest Fuzzlyn run that look caused or exposed by this PR: https://dnceng.visualstudio.com/public/_build/results?buildId=1914436&view=ms.vss-build-web.run-extensions-tab (ignore linux-arm examples)

At this point I don't think we should take this for 7.0.0 since we may have a bug tail to work through. I will revert it, but please feel free to resubmit it and look into those issues.

jakobbotsch added a commit to jakobbotsch/runtime that referenced this pull request Aug 1, 2022
jakobbotsch added a commit that referenced this pull request Aug 1, 2022
SingleAccretion added a commit to SingleAccretion/runtime that referenced this pull request Aug 22, 2022
* Consolidate importer spilling code (dotnet#72291)

* Add tests

* Fix losing GLOB_REF on the LHS

The comment states we don't need it, which is incorrect.

Diffs are improvements because we block forward substitution of
calls into "ASG(BLK(ADDR(LCL_VAR<field>, ...)))", which allows
morph to leave the "can be replaced with its field" local alone.

* Prospective fix

Spill "glob refs" on stores to "aliased" locals.

* Delete now-not-necessary code

* Fix up asserts

* Clean out '(unsigned)CHECK_SPILL_ALL/NONE' casts

* Don't manually spill for 'st[s]fld'

* Revert 'Clean out '(unsigned)CHECK_SPILL_ALL/NONE' casts'

* Fix assignments done via return buffers

The mistake in logic was that the only trees which could modify
unaliased locals are assignments, which is not true, calls can
do that as well.

One day we will move the return buffer handling out of importer,
but until then, special handling is required.

An alternative fix would have been to bring back the explicit
"impSpillLclRefs" to "stloc/starg" code, but that would contradict
the overall goal of consolidating the spilling logic.
@ghost ghost locked as resolved and limited conversation to collaborators Aug 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Importer's spilling logic is incomplete in subtle ways
3 participants